package com.andy.beef.ui.main.adapter

import android.graphics.Color
import android.view.View
import com.andy.beef.R
import com.andy.beef.ui.main.bean.HomeDataBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder


class CowMonthAgeAdapter : BaseQuickAdapter<HomeDataBean, BaseViewHolder>(R.layout.main_adapter_cow_month_age) {

    override fun convert(holder: BaseViewHolder, item: HomeDataBean) {
        val view = holder.getView<View>(R.id.view)
        view.setBackgroundColor(Color.parseColor(item.color))
        holder.setText(R.id.tv_desc, item.desc)
        if (item.count.isEmpty()) {
            holder.setText(R.id.tv_count, "-")
        } else {
            val key = context.getString(R.string.main_cow_count_str, item.count)
            holder.setText(R.id.tv_count, key)
        }
    }
}